{__NOLAYOUT__}
{include file="../application/app/view/header.html"}
</head>
<body class="container-fluid">
	<div class="col-md-12">
		<div class="alert kesn_prompt"></div>
	</div>
<section>
	    <form class="form-horizontal">
	    	 <div class="form-group">
              <label for="user_id" class="col-lg-2 control-label col-md-2 col-sm-2">ID</label>
              <div class="col-lg-8 col-md-8 col-sm-8">
                <input type="text" class="form-control" id="user_id" placeholder="ID" value="{$user_info.id}" disabled="disabled">
              </div>
            </div>
            <div class="form-group">
              <label for="user_name" class="col-lg-2 control-label col-md-2 col-sm-2">用户名</label>
              <div class="col-lg-8 col-md-8 col-sm-8">
                <input type="text" class="form-control" id="user_name" placeholder="用户名" value="{$user_info.user_name}">
              </div>
            </div>
            <div class="form-group">
              <label for="user_type" class="col-lg-2 control-label col-md-2 col-sm-2">用户类型</label>
              <div class="col-lg-8 col-md-8 col-sm-8">
                <input type="text" class="form-control" id="user_type" placeholder="用户类型" value="{$user_info.usertype}" disabled="disabled">
              </div>
            </div>
            <div class="form-group">
              <label for="password" class="col-lg-2 control-label col-md-2 col-sm-2">密码</label>
              <div class="col-lg-8 col-sm-8">
                <input type="password" class="form-control" id="password" placeholder="密码">
              </div>
            </div>
            <div class="form-group">
              <label for="password_sure" class="col-lg-2 col-sm-2 control-label">确认密码</label>
              <div class="col-lg-8 col-md-8 col-sm-8">
                <input type="password" class="form-control" id="password_sure" placeholder="请再次输入密码">
              </div>
            </div>
            
            <div class="form-group">
              <div class="col-lg-offset-2 col-lg-10">
                <a class="btn btn-primary" id="save_user">修改</a>
              </div>
            </div>
          </form>
</section>


{include file="../application/app/view/footer.html"}
<script type="text/javascript">
	$('#save_user').click(function(){
		var user_id = $('input#user_id').val();
		var user_name = $.trim($('input#user_name').val());
		var usertype = $('input#user_type').val();
		var password = $.trim($('input#password').val());
		var password_sure = $.trim($('input#password_sure').val());
		if (user_name == '') {
			alert('用户名不能为空！');
			return;
		}
		if (password == '') {
			alert('密码不能为空！');
			return;
		}
		if (password != password_sure) {
			alert('密码和确认密码值不同！');
			return;
		}
		$.ajax({
		       url: "save_user_action",    //请求的url地址
		      dataType: "json",   //返回格式为json
		      async: true, //请求是否异步，默认为异步，这也是ajax重要特性
		      data: { "user_id": user_id,"user_name" : user_name,"usertype":usertype,"password":password },    //参数值
		      type: "POST",   //请求方式
		      success: function(data) {
		        if (data.err == '0') {
		        	kesn_prompt('success',data.content);
		        }else{
		        	kesn_prompt('fail',data.content);
		        }
		      }
		});
	});
</script>
</footer>
</body>
</html>